#!/bin/bash

usage="Usage: ./pv_avail.sh StorageClassName"
if [ $# -ne 1 ]; then
	echo $usage
else
	for persistentvolume in `kubectl get pv | grep $1 | awk '{print $1}'`
	do
	kubectl patch pv $persistentvolume --type json -p '[{"op": "remove", "path": "/spec/claimRef/uid"}]'
	#echo "persistentvolume -> $persistentvolume clear"
	done
fi